{% extends 'admin/index.html' %}

{% block con-title %}
    <div class="container-fluid am-cf">
        <div class="row">
            <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                <div class="page-header-heading">
                    <span class="am-icon-users page-header-heading-icon"></span>
                     订单列表
                   </div>
            </div>
          
        </div>
    </div>
{% endblock %}

{% block con-body %}
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title  am-cf">订单列表</div>
                </div>
                <div class="widget-body  am-fr">

                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-xs">
                                    <button type="button" class="am-btn am-btn-default am-btn-success"><span class="am-icon-plus"></span> 新增</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-secondary"><span class="am-icon-save"></span> 保存</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-warning"><span class="am-icon-archive"></span> 审核</button>
                                    <button type="button" class="am-btn am-btn-default am-btn-danger"><span class="am-icon-trash-o"></span> 删除</button>
                                </div>
                            </div>
                        </div>
                    </div>
                <form action="" method="get">
                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                        <div class="am-form-group tpl-table-list-select">
                            <select name="type" data-am-selected="{btnSize: 'sm'}" style="display: none;">
                              <option{% if request.GET.type == 'username' %} selected {% endif %} value="username">订单号</option>
                              <option{% if request.GET.type == 'email' %} selected {% endif %} value="email">总价</option>
                              <option{% if request.GET.type == 'phone' %} selected {% endif %} value="phone">订单状态</option>
                              <option{% if request.GET.type == 'age' %} selected {% endif %} value="age">下单时间</option>
                            </select>
                        </div>
                    </div>
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-3">
                        <div class="am-input-group am-input-group-sm tpl-form-border-form cl-p">
                            <input name="keywords" value="{{ request.GET.keywords }}" type="text" class="am-form-field ">
                            <span class="am-input-group-btn">
                                <button class="am-btn  am-btn-default am-btn-success tpl-table-list-field am-icon-search"></button>
                              </span>
                        </div>
                    </div>
                </form>

                    <div class="am-u-sm-12">
                        <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                            <thead>
                                <tr>
                             
                                    <th>订单号</th>
                                    <th>总价</th>
                                    <th>下单时间</th>
                                    <th>订单状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>

                            {% for v in list %}
                                <tr class="gradeX">
                                
                                    <td class="am-text-middle">{{ v.id }}</td>
                                    <td class="am-text-middle">{{ v.totalprice }}</td>
                                    <td class="am-text-middle">{{ v.addtime|date:'Y-m-d H:i:s' }}</td>
                                   
                                    <td class="am-text-middle isDelete">
                                        {% if v.status == 1  %}
                                            未支付
                                        {% elif v.status == 2 %}
                                            已支付,待发货
                                        {% elif v.status == 3 %}
                                            已发货,待收货
                                        {% elif v.status == 4 %}
                                            以收货 待评价
                                        {% else %}
                                            已取消
                                        {% endif %}
                                    </td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            {% if v.status == 2 %}
                                                <a href="javascript:fahuo({{ v.id }});" >
                                                    <i class="am-icon-pencil"></i>发货 
                                                </a>
                                            {% endif %}
                                            
                                        </div>
                                    </td>
                                </tr>
                            {% endfor %}
                                <!-- more data -->
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">

                        <div class="am-fr">
                            <ul class="am-pagination tpl-pagination">
                                
                                
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    
    function fahuo(obj){
        $.ajax({
            url:'{% url "myadmin_dingdan_edit" %}',
            data:{id:obj},
            type:'get',
            datatype:'json',
            success:function(data){
                location.href = location.href
            }
        })
    }
</script>
{% endblock %}